<!-- eslint-disable vue/multi-word-component-names -->
<template>
  <div class="body">
    <div class="left">
      <div class="header">
        <img :src="user.img" alt="" />
        <div>
          <p class="name">{{ user.name }}</p>
          <p class="identity">{{ user.identity }}</p>
          <el-button>个人信箱</el-button>
        </div>
      </div>
      <div class="Email">
        电子邮箱:&nbsp;&nbsp;
        <i>{{ user.Email }}</i>
      </div>
      <div class="Email">
        手机号码:&nbsp;&nbsp;
        <i>{{ user.telephone }}</i>
      </div>
      <div class="bottom">
        <router-link to="information" @click.stop="selectAction('information')">
          <div :class="{ action: isActive('information') }">个人信息</div>
        </router-link>
        <router-link to="changePassword" @click.stop="selectAction('changePassword')">
          <div :class="{ action: isActive('changePassword') }">修改密码</div>
        </router-link>
        <!-- <router-link to="changeAvatar" @click.stop="selectAction('changeAvatar')">
          <div :class="{ action: isActive('changeAvatar') }">修改头像</div>
        </router-link>
        <router-link to="operationLogs" @click.stop="selectAction('operationLogs')">
          <div :class="{ action: isActive('operationLogs') }">操作日志</div>
        </router-link> -->
      </div>
    </div>
    <div class="right">
      <router-view></router-view>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'
const activeAction = ref('information')
const user = ref({
  id: 1,
  name: '张三',
  img: '../../assets/userImg.png',
  identity: '老师',
  Email: '123456@qq.com',
  telephone: '15622223333'
})
const selectAction = (action) => {
  activeAction.value = action // 更新当前激活的action
  // 这里可以添加其他逻辑，如导航守卫中的逻辑
}
const isActive = (action) => {
  return activeAction.value === action // 判断当前action是否激活
}
</script>

<style scoped lang="less">
.body {
  width: 1350px;
  display: flex;
  justify-content: space-between;
  // background-color: pink;
  color: #4d4d4d;
  margin: 30px auto;
  .left {
    width: 320px;
    background-color: #fff;
    // border-radius: 10px;
    padding: 30px;
    .header {
      display: flex;
      margin-bottom: 30px;
      // justify-content: space-between;
      img {
        width: 100px;
        height: 100px;
        background-color: #666;
        // background-image: url(../../assets/userImg.png);
        margin-right: 20px;
        border-radius: 10px;
      }
      .name {
        margin: 5px 0 10px 0;
      }
      .identity {
        font-size: 12px;
        font-weight: 300;
        margin-bottom: 15px;
      }
    }
    .Email {
      font-size: 14px;
      margin-bottom: 10px;
      i {
        color: #666;
      }
    }
    .bottom {
      margin-top: 40px;
      a {
        text-decoration: none;
      }
      div {
        border: 0;
        background-color: #fff;
        color: #666;
        width: 100%;
        height: 40px;
        line-height: 20px;
        padding: 10px 20px;
        border-radius: 5px;
        margin: 10px;
        display: flex;
        cursor: pointer;
        // background-image: url(../../assets/userxx.png);
        &:hover {
          background-color: #e9f2fa;
          color: #1461cd;
        }
      }
      .action {
        background-color: #e9f2fa;
        color: #1461cd;
      }
    }
  }
  .right {
    width: 1000px;
    background-color: #fff;
  }
}
</style>
